package com.ljw;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class Board2 extends JPanel{
	private Image hahaha;
	
	public Board2(){
		initBoard();
	}

	private void initBoard() {
		loadImage();
		
		int w = hahaha.getWidth(this);
		int h = hahaha.getHeight(this);
		setPreferredSize(new Dimension(w, h));
	}

	private void loadImage() {
		ImageIcon ii = new ImageIcon("./resource/img/hahaha.jpg");
		hahaha = ii.getImage();
	}
	
	@Override
	public void paintComponent(Graphics g){
		//super.paintComponent(g);
		g.drawImage(hahaha, 0, 0, null);
	}
}